Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gaussian integral #46

Merged
merged 4 commits into from
Sep 23, 2024
Merged

Fix gaussian integral #46

merged 4 commits into from
Sep 23, 2024

Conversation

RainerHeintzmann
Copy link
Member

fixed a bug with the normalization of Gaussian filtering. Added some tests, which also test the previously buggy case of zero-integral arrays.

Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 82.75862% with 5 lines in your changes missing coverage. Please review.

Project coverage is 93.97%. Comparing base (5b3f93a) to head (6f60872).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/fourier_filtering.jl 82.75% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   93.01%   93.97%   +0.96%     
==========================================
  Files          18       18              
  Lines        1031     1046      +15     
==========================================
+ Hits          959      983      +24     
+ Misses         72       63       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebaseb98
Copy link

Thank you for the fast implementation! Looks good to me :)

@@ -90,7 +90,19 @@ function fourier_filter(arr, fct=window_gaussian; kwargs...)
return fourier_filter!(copy(arr), fct; kwargs...)
end

function fourier_filter_by_1D_FT!(arr::TA, wins::AbstractVector; transform_win=false, dims=(1:ndims(arr))) where {N, TA <: AbstractArray{<:Complex, N}}
"""
fourier_filter_by_1D_FT!(arr::TA, wins::AbstractVector; transform_win=false, normalize_win=false, dims=(1:ndims(arr))) where {N, TA <: AbstractArray{<:Complex, N}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe transform_win and normalize_win.
I think being more verbose would be better here since win is confusing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. Don't understand your comment. It is called "normalize_win" and you suggest the same?
We should definitely not change transform_win to stay backwards compatible. So I agree that "win" should be more verbose but consistency is also important.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok didn't see this was already in the old version

wins[d]
if (normalize_win)
if (wins[d][1] != 0 && wins[d][1] != 1)
wins[d] ./ wins[d][1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line is not covered by tests

+`normalize_win`: specifies whether the directional windows (after potential FFT) each need to be normalized to a value of 1 at the zero frequency coordinate.
+`dims`: the dimensions to apply this separable multiplication to. If empty, the array will not be filtered.
"""
function fourier_filter_by_1D_RFT!(arr::TA, wins::AbstractVector; dims=(1:ndims(arr)), transform_win=false, normalize_win=false, kwargs...) where {T<:Real, N, TA<:AbstractArray{T, N}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windows instead of wins

@roflmaostc roflmaostc merged commit 58c675e into main Sep 23, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants